//
// Created by 张兮兮 on 2025/3/12.
//

#ifndef TEMP_SOCKETWIDGET_H
#define TEMP_SOCKETWIDGET_H
#include "Python.h"
#include <QWidget>
#include <QTimer>
#include <QPainter>
#include <QBuffer>
#include <QLocalSocket>
#include <QElapsedTimer>
class SocketWidget : public QWidget {
Q_OBJECT
public:
    SocketWidget(QWidget *parent = nullptr);

    ~SocketWidget();

protected:
    void paintEvent(QPaintEvent *event) override;

private:
    void sendImage();

    void refresh();
private slots:
    void onButtonClicked();
//void tryConnect();
    void readData();
    void handleProcessOutput();

private:
    bool isConnected = false;
    QString socketPath;
    QElapsedTimer timer;
    QLocalSocket *socket;
    QTimer *timerUpdate;
    QImage image;

    QPixmap transparent;
};

#endif //TEMP_SOCKETWIDGET_H
